package face.pay.api.alipay.api;

import face.pay.api.alipay.service.IAliPayAuthService;
import face.pay.util.ResultMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 应用授权回调
 */
@Controller
@RequestMapping("/aliPay/auth")
@Slf4j
public class ApiAliAuth {

    @Autowired
    private IAliPayAuthService iAliPayAuthService;



    @RequestMapping("/call_back")
    public String  auth(String app_auth_code , String app_id, String state, Model model){

        log.error("支付宝应用授权");
        log.error("app_auth_code:"+app_auth_code);
        log.error("app_id:"+app_id);
        log.error("state:"+state);

        ResultMessage resultMessage = this.iAliPayAuthService.auth(app_auth_code,app_id,state);

        model.addAttribute("authMessage",resultMessage);
        return "auth_info";
    }


}
